|
|
|
|
|
|
|
'
End Sub
Public Sub MoveNext(frmTemp As Object)
'
' move item from rtb into form controls
'
Dim strRecLine As String
'
' position record pointer
If intRecNum < intRecordCount Then
intRecNum = intRecNum + 1
End If
'
GetSQLRec intRecNum, strRecLine, frmTemp
'
End Sub |
|
|
|
|
|
|
|
|
You need only three more library functions before you have a complete ODBC database kit. You need routines that can write an updated existing record, add a new record, and delete an existing record from the dataset. These three routines can be called from your data-entry form and look much like the standard add, edit, and delete operations used with data-bound controls. |
|
|
|
|
|
|
|
|
First, create the DelRow method and enter the code in Listing 19.20. |
|
|
|
|
|
|
|
|
Listing 19.20. Coding the DelRow method. |
|
|
|
|
|
|
|
|
Public Sub DelRow(frmTemp As Object)
'
' remove a row from the table
'
Dim intResult As Integer
Dim strSQL As String
'
' make statement
strSQL = "DELETE * FROM " & strTable & " WHERE "
strSQL = strSQL & strKey & "='" & frmTemp.sqlfield(0) & "'"
'
' make the call
intResult = SQLExecDirect(hStmt, strSQL, Len(strSQL))
If intResult <> sqlSuccess Then
sqlErrorMsg "Unable to delete row"
intResult = SQLFreeStmt(hStmt, sqlClose)
End If
'
End Sub |
|
|
|
|
|
|
|
|
The routine in Listing 19.20 is designed to delete the current record loaded into the text controls on the form, and it requires only a pointer to the form as a parameter. The name of |
|
|
|
|
|